/*
 * Copyright 2010 Christoph Widulle (christoph.widulle@googlemail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */



package com.android1.amarena2d.nodes.sprites;

import com.android1.amarena2d.animation.AtlasAnimation;
import com.android1.amarena2d.annotations.Incomplete;
import com.android1.amarena2d.nodes.behavior.delegates.AnimatedActionTarget;
import com.android1.amarena2d.nodes.behavior.delegates.AnimationDelegate;
import com.android1.amarena2d.nodes.behavior.delegates.SetFrameAnimationDelegate;
import com.android1.amarena2d.texture.TextureFrame;

@Incomplete
public class AtlasBatchedSprite extends BatchedSprite<AtlasSpriteBatchNode> implements AnimatedActionTarget.SetFrame {

    protected AnimationDelegate animationDelegate;

    public AtlasBatchedSprite(AtlasAnimation animation) {
        this(animation, 0, 0);
    }

    public AtlasBatchedSprite(AtlasAnimation animation, float x, float y) {
        super(animation.getFrame(0).getTextureFrame(), x, y);
        this.animation().setDefaultAnimation(animation);
    }


    public AtlasBatchedSprite(TextureFrame textureFrame) {
        super(textureFrame);
    }

    public AtlasBatchedSprite(TextureFrame textureFrame, float x, float y) {
        super(textureFrame, x, y);
    }

    public AnimationDelegate animation() {
        if (animationDelegate == null)
            animationDelegate = new SetFrameAnimationDelegate(this);
        return animationDelegate;
    }

    public AtlasBatchedSprite xy(float x, float y) {
        setXY(x, y);
        return this;
    }


}